package moving2;

public class Main extends javax.swing.JPanel {
        protected javax.swing.JButton b1, b2, b3;
        protected javax.swing.JTextField tf1;
        
        public Main() {
            b1 = new javax.swing.JButton("Increment");
            b1.setVerticalTextPosition(javax.swing.AbstractButton.CENTER);
            b1.setHorizontalTextPosition(javax.swing.AbstractButton.LEADING);
            b1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    b1ButtonActionPerformed(evt);
                }
            });            
            b2 = new javax.swing.JButton("Decrement");
            b2.setVerticalTextPosition(javax.swing.AbstractButton.CENTER);
            b2.setHorizontalTextPosition(javax.swing.AbstractButton.LEADING);
            b2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    b2ButtonActionPerformed(evt);
                }
            });  
            tf1 = new javax.swing.JTextField("70");
            add(b1);
            add(b2);
            add(tf1); 
        }
        
        protected void b1ButtonActionPerformed(java.awt.event.ActionEvent evt) {
            int cval = Integer.valueOf(tf1.getText()) + 1;
            tf1.setText(Integer.toString(cval));
            System.out.println(cval);
        }

        protected void b2ButtonActionPerformed(java.awt.event.ActionEvent evt) {
            int cval = Integer.valueOf(tf1.getText()) - 1;
            tf1.setText(Integer.toString(cval));
            System.out.println(cval);            
        }        
          
    private static void createMainFrame() {
            
        javax.swing.JFrame frame = new javax.swing.JFrame("Columbus Moving");
        frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
        
        javax.swing.JLabel emptyLabel = new javax.swing.JLabel("123");
        emptyLabel.setPreferredSize(new java.awt.Dimension(800, 600));
        
        Main newContentPane = new Main();
        newContentPane.setOpaque(true);
        frame.setContentPane(newContentPane);
	frame.setIconImage(getFDImage());
        frame.pack();
        frame.setSize(new java.awt.Dimension(800, 600));
        frame.setVisible(true);       
    }

    protected static java.awt.Image getFDImage() {
        java.net.URL imgURL = Main.class.getResource("images/FD.jpg");
        if (imgURL != null) {
            return new javax.swing.ImageIcon(imgURL).getImage();
        } else {
            return null;
        }
    }
        
    public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createMainFrame();
            }
        });
    }
}